<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!--管理员登录页面 -->
<!DOCTYPE html>
<html>
<head>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>管理员登录</title>
	<script type="text/javascript" src="js/jquery-2.1.1.js"></script>
	<link rel="stylesheet" href="css/reset.css" />
	<link rel="stylesheet" href="css/login.css" />
	<style type="text/css">
	.title{
	font-size:50px;
	color:white;
	text-align:center;
	margin-top:60px;
	font-family: "微软雅黑";
	}
	</style>
	<script type="text/javascript">
    	$(function(){
    		$("input[name='ok']").click(function(){
    			//alert(1);
    			var jpwd = $("#pwd").val()
    			if($("#name").val()==null || $("#name").val()==""){
    			alert("帐户不能为空！");
    			$("#name").focus();
    			return false;
        		}
        		
        		if($("#pwd").val()==null || $("#pwd").val()==""){
    			alert("密码不能为空！");
    			$("#name").focus();
    			return false;
        		}
        		
        		
        		$.ajax({
					type:'post',
					url:'${pageContext.request.contextPath}/servlet/QueryadminServlet',
					data:{
						account:$("#name").val(),pwd:$("#pwd").val()
					},
					success:function(response,status,xhr){
						var jsonArr = eval('('+response+')');
							if(jsonArr!=null){
								var url = "admin_frame.jsp";
								window.location.href = url;
							}else{
								alert("登录失败！！！该管理员不存在，请检查账户，重新登录！！！");
								var url = "Admin_login.jsp";
								window.location.href = url;
							}
					}
				});
        		
    		});
    	});
    </script>
</head>
<body>

<div class="page" >
	<div class="title">二手物品交易系统后台</div>
	<div class="loginwarrp">
		<div class="logo">管理员登陆</div>

        <div class="login_form">
        <span><s:actionerror/></span>
			<form  method="post" theme="simple" >
				<li class="login-item">
					<span>名　称：</span>
					<input type="text" name="account" class="login_input" id="name">
				</li>
				<li class="login-item">
					<span>密　码：</span>
					<input type="password" name="password" class="login_input" id="pwd">
				</li>
				<div class="clearfix"></div>
				<li class="login-sub">
					<input type="button" name="ok" value="登录"/>
				</li>
           </form>
		</div>
	</div>
</div>
</body>
</html>